package com.xt.purchasingsystem.controller.stockManagement;

import com.xt.purchasingsystem.dto.DFileDto;
import com.xt.purchasingsystem.dto.SPayDto;
import com.xt.purchasingsystem.model.SPay;
import com.xt.purchasingsystem.service.stockManagementService.OutboundApplicationManageService;
import com.xt.purchasingsystem.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 库存管理-->出库申请管理所有接口
 * Author: 老姚
 * Date:  2020/3/22 17:40
 */
@RestController
@RequestMapping(value = "/outboundApplicationManagement")
public class OutboundApplicationManagementController {
    @Autowired
    private OutboundApplicationManageService outboundApplicationManageService;

    @PostMapping("/getAllStorageByPage")
    public Result getAllStorageByPage(@RequestBody DFileDto dFileDto){
        return outboundApplicationManageService.getAllStorageByPage(dFileDto);
    }

    /**
     *多条件分页查询可以提交出库申请单的接口
     * @param dFileDto
     * @return
     */
    @PostMapping("/getbyscelltag")
    public Result getbyscelltag(@RequestBody DFileDto dFileDto){
        return outboundApplicationManageService.selectallfile(dFileDto);
    }

    /**
     *出库申请单提交的接口
     * @param sPayDto
     * @return
     */
    @PostMapping("/addoutboundinformation")
    public Result addoutboundinformation(@RequestBody SPayDto sPayDto){
        return outboundApplicationManageService.addoutboundinformation(sPayDto);
    }

    /**
     * 分页查询所有未审核的出库申请单及其明细的接口
     * @param currNo
     * @param pageSize
     * @return
     */
    @GetMapping("/getAllNoCheckSpay/{currNo}/{pageSize}")
    public Result getAllNoCheckSpay(@PathVariable Integer currNo, @PathVariable Integer pageSize) {
        return outboundApplicationManageService.getAllNoCheckSpayByPage(currNo, pageSize);
    }

    /**
     * 审核出库申请单的接口
     * @return
     */
    @PutMapping("/checkSpay")
    public Result checkSpay(@RequestBody SPay sPay){
        return outboundApplicationManageService.checkSpay(sPay);
    }
}
